
import {createApp} from 'vue'
import App from '@/App.vue'
import Antd from "ant-design-vue"
import "ant-design-vue/dist/antd.css"
import router from './router'
import pinia from './store'
import * as icons from '@ant-design/icons-vue'
import useUserStore from '@/store/users'
import {RouteRecordRaw} from 'vue-router'
const app=createApp(App)
for (const i in icons) {
    app.component(i, icons[i])
  }

const dyncRoute=()=>{
    const store=useUserStore()
     //完成向pinia发送请求，然后获取权限
     store.getAuthMenuAsync()
     //调用首页路由对象
     const homeRoute:RouteRecordRaw=store.getHomeRoute
     //添加到路由对象上
     router.addRoute(homeRoute)
     console.log('路由集合',router.getRoutes());
  }


app.use(pinia) //设置pinina插件到vue实例上
app.use(Antd)   //设置antd插件到vue实例上

dyncRoute()
//在app.use(router)之前进行路由添加调用，可以解决页面刷新的问题
app.use(router) //设置router插件到vue实例上

app.mount('#app')

